<template>
  <div>
    模块管理
    <elGridTree
      v-bind="girdMeta"
      :data-list="dataList"
      :selection="myChoice"
    /><br>{{myChoice}}
  </div>
</template>

<script>
import { reactive } from 'vue'
// 加载json
import loadJson from '../controller/loadjson.js'
// eslint-disable-next-line import/no-absolute-path
import _elGridTree from '/ctrl/nf-el-grid/nf-el-grid-tree.vue'

</script>

<script setup>

const elGridTree = _elGridTree

 // 列表用的 meta
  const girdMeta = reactive ({reload:false})
  // 依据模块ID，加载meta
  loadJson(104, 'grid', girdMeta)

  const myChoice = reactive({
    dataId: '', // 单选ID number 、string
    row: {}, // 单选的数据对象 {}
    dataIds: [], // 多选ID []
    rows: [] // 多选的数据对象 []
  })

  const dataList2 = reactive([
    {
      ID: 1,
      hasChildren: true,
      CompanyId: 1,
      CompanyName: '22'
    },
    {
      ID: 2,
      hasChildren: true,
      CompanyId: 2,
      CompanyName: '344'
    }
  ])

  const dataList = reactive([
    {
      ID: 1,
      // hasChildren: true,
      CompanyId: 1,
      CompanyName: '基础模块',
      children: [
        {
          ID: 3,
          // hasChildren: true,
          CompanyId: 3,
          date: '2016-05-01',
          CompanyName: '角色管理',
          address: '',
          children: [
            {
              ID: 4,
              // hasChildren: true,
              CompanyId: 4,
              date: '2016-05-01',
              CompanyName: '权限设置',
              address: ''
            }
          ]
        },
        {
          ID: 5,
          // hasChildren: true,
          CompanyId: 5,
          date: '2016-05-01',
          CompanyName: '操作日志',
          address: ''
        }
      ]
    },
    {
      ID:2,
      // hasChildren: true,
      CompanyId: 2,
      CompanyName: '管理模块'
    }
  ])
</script>
